package qlsl.androiddesign.activity.subactivity;

import com.qlsl.androiddesign.kuaiwa.R;

import android.os.Bundle;
import android.widget.TextView;
import qlsl.androiddesign.activity.baseactivity.BaseActivity;
import qlsl.androiddesign.http.service.commonservice.MemberService;
import qlsl.androiddesign.method.UserMethod;
import qlsl.androiddesign.view.baseview.FunctionView;
import qlsl.androiddesign.view.subview.activityview.CopyView;
import qlsl.androiddesign.view.subview.activityview.SignView;

public class SignActivity extends BaseActivity {

	private SignView functionView;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		functionView = new SignView(this);
	}

	public FunctionView<?> getFunctionView() {
		return functionView;
	}

	@Override
	public void onNetWorkSucceed(String method, Object values) {
		if (method.equals("createSign")) {
			showToast("签到成功");
			MemberService.getUserInfo(functionView, this);
		} else if (method.equals("queryPointsGoodsList")) {
			functionView.showData(values);
		} else if (method.equals("getUserInfo")) {
			TextView tv_name = (TextView) functionView.getContentView()
					.findViewById(R.id.tv_name);
			tv_name.setText(UserMethod.getUser().getPoints() + "挖币");
		}
	}

	@Override
	public void onNetWorkFaild(String method, Object values) {
		if (method.equals("createSign") && values.equals("40000")) {
			showToast("重复签到");
		} else if (method.equals("createSign")) {
			showToast("签到失败");
		}
	}

}
